package cn.edu.sjtu.software.sjtucontacts.service.security;

//Encryption Algorithm Factory
public class EncryptAlgorithmFactory {
	private IEncryption encryptionAlgorithm;
	
	public EncryptAlgorithmFactory(int encryptionAlgorithmId){
		switch (encryptionAlgorithmId) {
			case EncryptAlgorithms.defaultEncryptAlgorithm:
				encryptionAlgorithm = new DefaultEncryptionAlgorithm();
				break;
			case EncryptAlgorithms.aesEncryptAlgorithm:
				encryptionAlgorithm = new AESEncryptionAlgorithm();
				break;
			case EncryptAlgorithms.desEncryptAlgorithm:
				encryptionAlgorithm = new DESEncryptionAlgorithm();
				break;
			case EncryptAlgorithms.desedeEncryptAlgorithm:
				encryptionAlgorithm = new DESedeEncryptionAlgorithm();
				break;
		}
	}
	
	public IEncryption getEncryptionAlgorithm(){
		return encryptionAlgorithm;
	}

}
